#猜数字游戏

import random

all = 1


while all == 1:
    num = int(random.random()*100)
    G = 5000

    while G >= 0:
        cai = input("请输入一个1到100之间的数字：")
        cai = int(cai)
        if cai > 0:
            if cai > num:
                G = G - 500
                print("大了")
            elif cai < num:
                G = G - 500
                print("小了")
            else:
                G = G + 3000
                print("恭喜猜中，本轮幸运数字：{}".format(num))
                print("剩余金币为：{}".format(G))
                break
        elif cai == -1:
            print("外挂，数字为：{}".format(num))
            # break
    else:
        print("金币已用完，游戏结束")

    choose = input("按1继续下一轮游戏")
    choose = int(choose)
    if choose == 1:
        pass
    else:
        all = 0
        print("游戏结束")

